package common

type R[T any] struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
	Data    T      `json:"data,omitempty"`
}

func SimpleSuccess() R[any] {
	return R[any]{
		Code:    200,
		Message: "ok",
	}
}

func Success[T any](data T) R[T] {
	return R[T]{
		Code:    200,
		Message: "ok",
		Data:    data,
	}
}

func Failed(msg string) R[any] {
	return R[any]{
		Code:    500,
		Message: msg,
	}
}
